/*
 Navicat Premium Data Transfer

 Source Server         : 127.0.0.1
 Source Server Type    : MySQL
 Source Server Version : 50720
 Source Host           : localhost:3306
 Source Schema         : test

 Target Server Type    : MySQL
 Target Server Version : 50720
 File Encoding         : 65001

 Date: 11/04/2018 16:25:15
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for chat_group
-- ----------------------------
DROP TABLE IF EXISTS `chat_group`;
CREATE TABLE `chat_group` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(10) NOT NULL DEFAULT '' COMMENT '群组名称',
  `owner_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '群主id',
  `status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '1 正常 -1 删除 0 审核',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户聊天群组表';

-- ----------------------------
-- Table structure for chat_notice
-- ----------------------------
DROP TABLE IF EXISTS `chat_notice`;
CREATE TABLE `chat_notice` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `send_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id/群组Id [发起方]',
  `method_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id/群组Id [接收方]',
  `type` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '消息类型 [1 +好友 2 申请+群组 3 邀请+群组]',
  `apply_msg` varchar(30) NOT NULL DEFAULT '' COMMENT '申请信息',
  `apply_time` varchar(20) NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '申请时间',
  `pass_time` varchar(20) NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '通过时间',
  `refuse_time` varchar(20) NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '拒绝时间',
  `is_read` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '0 未读 1 已读',
  `status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '1  通过 0 申请中 -1 拒绝',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='用户聊天好友/群组消息表';

-- ----------------------------
-- Records of chat_notice
-- ----------------------------
BEGIN;
INSERT INTO `chat_notice` VALUES (1, 3, 1, 1, 'ddddd', '2018-04-11 16:22:17', '2018-04-11 16:22:24', '0000-00-00 00:00:00', 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for chat_record
-- ----------------------------
DROP TABLE IF EXISTS `chat_record`;
CREATE TABLE `chat_record` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '发言人id',
  `chat_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '接收人id',
  `content` varchar(30) NOT NULL DEFAULT '' COMMENT '聊天内容',
  `sendtime` varchar(20) NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '发言时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户聊天记录表';

-- ----------------------------
-- Table structure for friend_relation
-- ----------------------------
DROP TABLE IF EXISTS `friend_relation`;
CREATE TABLE `friend_relation` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
  `friend_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '好友id',
  `status` tinyint(2) NOT NULL DEFAULT '1' COMMENT '1 正常 -1 删除',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='用户聊天用户与好友关系表';

-- ----------------------------
-- Records of friend_relation
-- ----------------------------
BEGIN;
INSERT INTO `friend_relation` VALUES (1, 1, 3, 1);
INSERT INTO `friend_relation` VALUES (2, 3, 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for group_relation
-- ----------------------------
DROP TABLE IF EXISTS `group_relation`;
CREATE TABLE `group_relation` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
  `group_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '好友id',
  `status` tinyint(2) NOT NULL DEFAULT '1' COMMENT '1 正常 -1 删除',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户聊天用户与群组关系表';

-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '用户ID',
  `mobile` char(11) NOT NULL DEFAULT '' COMMENT '用户手机号',
  `username` varchar(64) NOT NULL COMMENT '用户名',
  `password` varchar(100) NOT NULL COMMENT '密码',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='用户基本信息表';

-- ----------------------------
-- Records of users
-- ----------------------------
BEGIN;
INSERT INTO `users` VALUES (1, '13051396759', 'Sun', '123456');
INSERT INTO `users` VALUES (2, '15264891111', 'Rain', '456789');
INSERT INTO `users` VALUES (3, '13044556677', 'DAGE', 'dage');
INSERT INTO `users` VALUES (4, '13051396758', '123456', '123456');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
